#include <cstdio>
#include <queue>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

struct edge {
	int s, e;
	double r, c;
	double r2, c2;
	edge(): s(-1), e(-1), r(0), c(0), r2(0), c2(0) { }
	edge(int s, int e, double r, double c, double r2, double c2):
		 s(s), e(e), r(r), c(c), r2(r2), c2(c2) { }
};

#define MAXN 105

vector<edge> MAP[MAXN];
int N, M, S;
double V;
double dis[MAXN];
double dis2[MAXN];
int vis[MAXN];

int SPFA() {
	queue<int> q;
	memset(vis, 0, sizeof(vis));
	for (int i=1; i<=N; i++) {
		dis[i] = 0;
		dis2[i] = 0;
	}
	dis[S] = V;
	dis2[S] = V;
	vis[S] = true;
	q.push(S);
	
	while (!q.empty()) {
		int u = q.front(); q.pop();
		for (vector<edge>::iterator it = MAP[u].begin(); it != MAP[u].end(); it++) {
			edge e = *it;
			int v = e.e;
			double c = (dis[u]-e.c) * e.r;
			double c2 = (c-e.c2) * e.r2;
			if (dis2[v] < c2 && !vis[v]) {
				dis[v] = c;
				dis2[v] = c2;
				printf("%d-%d: %lf , %lf\n",u, v, c, c2);
				vis[v] = true;
				q.push(v);
			}
		}
		//vis[u] = false;
	}
	for (int i=1; i<=N; i++) {
		printf("%d: %lf\n", i, dis2[i]);
		if (i==S) continue;
		if (dis2[i] > V) {
			printf("Found %d : %lf\n", i, dis2[i]);
			return 1;
		}
	}
	return 0;
}

int main() {
	scanf("%d%d%d%lf", &N, &M, &S, &V);
	for (int i=1; i<=M; i++) {
		int a, b;
		double rab, cab, rba, cba;
		scanf("%d%d%lf%lf%lf%lf", &a, &b, &rab, &cab, &rba, &cba);
		MAP[a].push_back(edge(a, b, rab, cab, rba, cba));
		MAP[b].push_back(edge(b, a, rba, cba, rab, cab));
	}
	int r = SPFA();
	if (r) printf("YES\n");
	else printf("NO\n");
	return 0;
}
